package com.sunday.common.http.apache;

import com.sunday.common.core.gson.GsonUtils;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

/**
 * HTTP 响应结果
 *
 * @author zsy
 * @since 2022/10/15
 */
@Data
@AllArgsConstructor
public class HttpResult implements Serializable {

    /**
     * 响应状态码
     */
    private int code;

    /**
     * 响应数据
     */
    private String content;

    public static HttpResult of(int code, String content) {
        return new HttpResult(code, content);
    }

    @Override
    public String toString() {
        return GsonUtils.DEFAULT.toJson(this);
    }

}